<!--********************************************************************
* Copyright© 2000 - 2018 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title data-i18n="resources.title_animatorPoint">移动矢量图</title>
    <style type="text/css">
        body {
            margin: 0;
            overflow: hidden;
            background: #fff;
            width: 100%;
            height: 100%
        }

        #map {
            position: absolute;
            width: 100%;
            height: 100%;
            border: 1px solid #3473b7;
        }

        #toolbar {
            position: absolute;
            top: 50px;
            right: 10px;
            text-align: center;
            z-index: 100;
            border-radius: 4px;
        }
    </style>
</head>
<body>
        <!-- <h5 class='panel-title text-center' data-i18n="resources.title_animatorPoint"></h5> -->
<div id="map"></div>
  <script src="./libs/SuperMap.Include.js"></script>
<!-- <script type="text/javascript" include="bootstrap,widgets.alert" src="./libs/include-web.js"></script> -->
<!-- <script type="text/javascript" exclude="iclient-classic" src="./libs/include-classic.js"></script> -->
<script>
    var map, layer; 
	var animatorVector;
    var style =//声明样式
        {
			externalGraphic: "./theme/images/cluster1.png",
            fillColor: "#339933",
            fillOpacity: 1,
            strokeOpacity: 0,
            pointRadius: 12
        };
    init(); //初始化图层
    startAnimator()//调用动画效果
    function init() {
		//添加控件
        map = new SuperMap.Map("map", {
			allOverlays: true,
//             controls: [
//                 new SuperMap.Control.ScaleLine(),
//                 new SuperMap.Control.Zoom(),
//                 new SuperMap.Control.MousePosition(),
//                 new SuperMap.Control.Navigation({
//                     dragPanOptions: {
//                         enableKinetic: true
//                     }
//                 })
// 				]
        });
      //  map.addControl(new SuperMap.Control.LayerSwitcher(), new SuperMap.Pixel(42, 80));
     //  //通过向SuperMap云服务器发送请求得到SuperMap云服务发布的图层
        layer = new SuperMap.Layer.CloudLayer();
map.addControl(new SuperMap.Control.LayerSwitcher());//图层控制显示控件
        map.addLayers([layer]);

        map.setCenter(new SuperMap.LonLat(0,0), 0);
		//声明图层
        animatorVector = new SuperMap.Layer.AnimatorVector("Vector Layer", {needRecordDrawedFeature: true}, {
            speed: 0.0005,
            startTime: 0,
            endTime: 100
        });
        map.addLayers([animatorVector]);
        addPoint();
    }

    function addPoint() {
        var features = [];//矢量图
        var ti = 100;
        for (var i = 0; i < ti; i++) {
                if (features.length >= ti) {
                    var x = features[features.length - ti].geometry.x;
                    var y = features[features.length - ti].geometry.y;
					console.log(11111);
                }
                else {
                    var x = Math.random() * 20037508 * 2 - 20037508;
                    var y = Math.random() * 20037508 * 2 - 20037508;
					console.log(2222)
                }
             //   var xd = Math.random() * 1375080 * 2 - 1375080;
             //   var yd = Math.random() * 1375080 * 2 - 1375080;
                var point = new SuperMap.Geometry.Point(x , y );//矢量图层坐标显示位置
                var pointFeature = new SuperMap.Feature.Vector(point, {
                    FEATUREID:1,//生成矢量图标的数量
                    TIME: 0 + i * 1
                }, style);
				//	console.log(x);
				//	console.log(xd);
                features.push(pointFeature);
        }
        animatorVector.addFeatures(features);
    }

    function startAnimator() {
        animatorVector.animator.start();
    }

//     function pauseAnimator() {
//         animatorVector.animator.pause();
//     }
// 
//     function removeDrawedFeature() {
//         var features = animatorVector.getDrawedFeatures();
//         animatorVector.removeFeatures(features);
//     }

</script>

</body>
</html>